All Questions
Tagged with memory-optimizationjava
36 questions
5votes
4answers
1kviews
Custom Iterator for Processing Large Files
I frequently work with large files and implemented a custom iterator to process these files efficiently while minimizing memory usage. The iterator reads each line from a file, parses it into a ...
2votes
4answers
183views
Comparison of two excel files ignoring line order
Below is a simple method which compares contents of two excel files ignoring the line order. This method is working as expected. But, one of my peers in their code review mentioned that initializing ...
-2votes
1answer
108views
Default food property wording when translation not available
I have food table having number of foods, each food can have specific properties in multiple languages (en, es) like name, description etc. But it is not sure if all of the properties are always ...
2votes
3answers
157views
3votes
0answers
310views
screen recording application
I'm developing a screen recording application using java. I've modified code from https://dzone.com/articles/screen-record-play-using-java where all the external jars required for this application are ...
1vote
1answer
1kviews
Follow-up: How can we optimizing Java BigInteger operations?
This is the follow up question of How can we optimizing Java BigInteger operations? Problem Reduce the number to 1 in a minimal number of steps, following the rules: ...
3votes
2answers
286views
Java 8: Memory/Run-time Performance optimization to transform Json structure
Here is the sample Students json am processing ...
3votes
3answers
180views
Optimize Memory Java String Array
I was trying to solve one programming challenge : First input is a list of connections which is made of pair of IPv4 address. Each IP has its own state which starts with false, each connection also ...
3votes
2answers
4kviews
Hackerrank problem: Climbing the Leaderboard (Java)
I am solving the following Hackerrank problem: Climbing the Leaderboard. The problem statement: Alice is playing an arcade game and wants to climb to the top of the leaderboard and wants to track her ...
4votes
3answers
404views
How can I optimize my code that uses nested for loops?
I am working to solve a problem where I need to determine if a Point lies on a line connecting two other Points. For example, ...
4votes
2answers
144views
SPOJ - ADDREV (Adding Reversed Numbers)
https://www.spoj.com/problems/ADDREV/ My answer to ADDREV challenge on SPOJ (link to the problem given above), written in JAVA, was accepted. However, the timing was 1.23 and memory used was 82M, ...
4votes
1answer
72views
Reverse String : Recursion
We have to reverse char[] using recursion. Input: ["H","a","n","n","a","h"] Output: ...
2votes
1answer
118views
Grouping items in a list into inner lists
I have a function that looks up in a list the elements which share same values in order to group them. As a fast summary, this should be the input/output: [A, A',...
2votes
1answer
144views
Find the nearest coin to be collected in a game
I am creating a simple bot that collects coins in-game. The code runs under a game-loop so there are 60 ticks p/s Here is the function that I use to check for the nearest coin (Game object) to be ...
4votes
5answers
3kviews
Find The Duplicates in two arrays
Find The Duplicates Given two sorted arrays arr1 and arr2 of passport numbers, implement a function findDuplicates that returns an array of all passport numbers that are both in arr1 and arr2. Note ...